package com.hlcl.huaji.ctrl.adapter;

/**
 * Created by lichunlin on 16/9/21.
 */

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.hlcl.huaji.view.HomeFragment;
import com.hlcl.huaji.view.OrderFragment;

/**
 * Created by lichunlin on 16/8/12.
 */
public class OrderListPagerAdapter extends FragmentPagerAdapter {

    int PAGE_COUNT = 0;
    private String[] tabTitles;
    private HomeFragment homeFragment;

    public OrderListPagerAdapter(FragmentManager fm, String[] tabTitles, HomeFragment homeFragment) {
        super(fm);
        this.tabTitles = tabTitles;
        PAGE_COUNT = tabTitles.length;
        this.homeFragment = homeFragment;
    }

    @Override
    public Fragment getItem(int position) {
        OrderFragment orderFragment = OrderFragment.getInstance(position,homeFragment);
        return orderFragment;
    }

    @Override
    public int getCount() {
        return PAGE_COUNT;
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return tabTitles[position];
    }

}
